home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / sharware / debmono / getsel.asm < prev    next >
Encoding:
Assembly Source File  |  1995-10-03  |  1.7 KB  |  64 lines

  1. ;GetSel.ASM
  2. ;Copyright (c) 1992 Jay Munro
  3. ;First Published in PC Magazine June 16, 1992
  4. ;Syntax
  5. ;  Declare Function GetAbs%(Byval Segment%)
  6. ;  GoodSelector% = GetAbs%(&hB000)
  7. ;---------------------------------------------------------------------------
  8. ; GetAbs.ASM takes an incoming segment value and replaces it with
  9. ; a Windows compatible selector if it matches one of the 9 possible exported
  10. ; values.  If the value doesn't match it is checked to see if it is a valid
  11. ; selector, first a writeable one, then a readable one.  In the event it
  12. ; fails all the tests, a -1 is returned otherwise the original value or the
  13. ; substituted selector is returned.
  14. ;----------------------------------------------------------------------------
  15. ;Add these imports (notably __B000 to your module .DEF file).
  16. ;IMPORTS
  17. ;    LOCALINIT = KERNEL.4
  18. ;    LSTRLEN = KERNEL.90
  19. ;    ALLOCCSTODSALIAS = KERNEL.170
  20. ;    FREESELECTOR = KERNEL.176
  21. ;    UNLOCKSEGMENT = KERNEL.24
  22. ;    SETERRORMODE = KERNEL.107 
  23. ;    __0000H = KERNEL.183
  24. ;    __0040H = KERNEL.193
  25. ;    __A000H = KERNEL.174
  26. ;    __B000H = KERNEL.181
  27. ;    __B800H = KERNEL.182
  28. ;    __C000H = KERNEL.195
  29. ;    __D000H = KERNEL.179
  30. ;    __E000H = KERNEL.190
  31. ;    __F000H = KERNEL.194
  32.  
  33. .286P                           ;protected instructions below
  34.  
  35. .Model Small
  36.  
  37.     Public   _GETSEL
  38. ;   Include  Labnotes.inc
  39.     
  40. ;   Extrn   __0000H :ABS
  41. ;   Extrn   __0040H :ABS
  42. ;   Extrn   __A000H :ABS
  43.     Extrn   __B000H :ABS
  44. ;   Extrn   __B800H :ABS
  45. ;   Extrn   __C000H :ABS
  46. ;   Extrn   __D000H :ABS
  47. ;   Extrn   __E000H :ABS
  48. ;   Extrn   __F000H :ABS
  49.  
  50. .Code
  51.  
  52. _GETSEL Proc Near
  53.     Mov  AX,__B000h             ;get selector
  54. ;   Mov  AX,0FFFFh             ;get selector
  55.     ret
  56. _GETSEL EndP
  57. End
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.